const Notices = require('../models/notices')

async function createNotice(content) {
  return await Notices.create({ content, time: new Date() })
}
async function getNoticeList() {
  return await Notices.findAll({ order: [['time', 'DESC']] })
}
async function deleteNotice(id) {
  return await Notices.destroy({ where: { id } })
}

module.exports = {
  createNotice,
  getNoticeList,
  deleteNotice,
}
